package com.example.bbs.utils;

import java.util.Scanner;

/**
 * @auther: zhangxin
 * @Description:
 */
public class InputUtil {

    static Scanner sc = new Scanner(System.in);
    public static int inputOption(int min,int max){
        int in = 0;
        do{
            if(!sc.hasNextInt()){
                System.out.println("请重新输入数字:");
                sc.next();
                continue;
            }
            in = sc.nextInt();
            if(in < min || in > max){
                System.out.println("输入错误!请重新输入:");
                continue;
            }
            break;
        }while(true);
        return in;
    }

    public static String inputStrInfo(){
        String strInfo = sc.next();
        return strInfo;
    }

    public static String inputStrLineInfo(){
        Scanner in = new Scanner(System.in);
        String strInfo = in.nextLine();
        return strInfo;
    }

    public static void inputStrLine(){
        sc.nextLine();
        return;
    }

    public static int inputIntInfo(){
        int intInfo = 0;
        if(sc.hasNextInt()){
            intInfo = sc.nextInt();
        }else{
            intInfo = sc.next().charAt(0);
        }
        return intInfo;
    }
}
